<?php
namespace App\Plugins\Shh;


use MongoDB\Model\BSONDocument;

class customer
{
    public $id;
    public $cid;
    public $shhKey;
    public $nickName;
    public $name;
    public $address;
    public $mobile;
    public $_v;

    public function __construct(BSONDocument $customer)
    {
        $this->id = (string) $customer->_id;
        $this->cid = $customer->cid;
        $this->shhKey = $customer->shhKey;
        $this->nickName = $customer->nickName;
        $this->name = (array) $customer->name;
        $this->address = (array) $customer->address;
        $this->mobile = (array) $customer->mobile;
        $this->_v = $customer->_v;
    }

    public function getInfo() {
        return [
            'cid' => $this->cid,
            'name' => $this->name,
            'mobile' => $this->mobile,
            'address' => $this->address,
        ];
    }
}